<?php

namespace App\Http\Requests;


class LoginRequest extends BaseRequest
{
    protected $rules = [

    ];

    //这里我只写了部分字段，可以定义全部字段
    protected $strings_key = [
        'wx_code'=>'微信code',
    ];

    public function rules()
    {
        $function = request()->route()->getAction();
        //dd($function);
        $rules = $this->rules;
        // 根据不同的情况, 添加不同的验证规则

        if ($function['controller'] == 'App\Http\Controllers\Api\LoginController@wx_login')
        {
            $rules=[
                'wx_code'=>'required',
            ];
        }

        return $rules;

    }
}
